package com.owc.domain.vo.admin;

import com.owc.domain.PageVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author xiaom
 * @Date 2020/2/28 16:28
 * @Version 1.0.0
 * @Description <>
 **/
@Data
@ApiModel("产品列表查询入参")
public class ProductQueryVo extends PageVo implements Serializable {

    @ApiModelProperty("产品ID")
    private Long id;

    @ApiModelProperty("产品名称")
    private String name;

    @ApiModelProperty("状态 1(上架) -1(下架) 5(前台隐藏) 10(售完)")
    private Integer status;

    @ApiModelProperty("创建人名称")
    private String createName;

    @ApiModelProperty("状态合集")
    private List<Integer> statusList;

    /**
     * 初始化状态合集
     */
    public void loadStatus(){
        if(statusList == null) statusList = new ArrayList<>();
        if(status != null){
            statusList.add(status);
        }
        if(statusList.isEmpty()){
            statusList = null;
        }
    }
}
